import elSelectLoadMore from "./component/elSelect/loadMore";
import clickoutside from "./component/clickoutside";
import hasRole from "./permission/hasRole";
import hasPermi from "./permission/hasPermi";

const compDirectives = [elSelectLoadMore, clickoutside];
const permissionDirectives = [hasRole, hasPermi];
const directives = compDirectives.concat(permissionDirectives);

const install = function (Vue) {
  directives.forEach((item) => {
    Vue.directive(item.name, item);
  });
};

if (window.Vue) {
  directives.forEach((item) => {
    window[item.name] = item;
  });
  Vue.use(install);
}

export default install;
